<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('底薪活动列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">活动名称：</label>
                                <input type="text" name="actName"/>
                            </li>
                            <li>
                                <label style="width: 100px;">活动状态：</label>
                                <select name="status">
                                    <option value="">请选择</option>
                                    <option value="1">开启</option>
                                    <option value="2">关闭</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px;">活动开始时间：</label>
                                <input type="text" class="time-input" readonly  placeholder="开始时间" name="start"/>
                                <span>-</span>
                                <input type="text" class="time-input" readonly  placeholder="结束时间" name="end"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px;">创建时间：</label>
                                <input type="text" class="time-input" readonly placeholder="开始时间" name="start2"/>
                                <span>-</span>
                                <input type="text" class="time-input" readonly placeholder="结束时间" name="end2"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('salaryPlan:agentActivity:edit')}]];
        var removeFlag = [[${@permission.hasPermi('salaryPlan:agentActivity:remove')}]];
        var prefix = ctx + "salaryPlan/agentActivity";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "底薪活动列表",
                firstLoad: true,
                clickToSelect: true,
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: '活动编号'
                },
                {
                    field: 'actName',
                    title: '活动名称'
                },
                {
                    field: 'startDate',
                    title: '活动开始时间'
                },
                {
                    field: 'endDate',
                    title: '活动结束时间'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        if (value == 1 ){
                            return '<span style="color: green">开启</span>';
                        } else if(value == 2 ){
                            return '<span style="color: red">关闭</span>';
                        }
                    },
                },
                {
                    field: 'createDate',
                    title: '创建时间'
                },
                {
                    field: 'createMan',
                    title: '创建人'
                },
               ]
            };
            $.table.init(options);
        });

        /* 查找带回选中回调 */
        function submitHandler(index, layero) {
            var rows = $.table.selectFirstColumns();
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            $.modal.close();
            parent.$('#actId').val($.table.selectColumns("id"));
            parent.$('#actName').val($.table.selectColumns("actName"));
        }

    </script>
</body>
</html>